﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Enter.DataProxy.Cache
{
    public interface ICacheService
    {
        /// <summary>
        /// 是否使用缓存
        /// </summary>
        bool IsCache();

        /// <summary>
        /// 释放服务器链接进程
        /// </summary>
        void ReleaseConnection();

        /// <summary>
        /// 清除当前缓存区的所有缓存
        /// </summary>
        void DeltelCache();

        /// <summary>
        /// 根据Key获取缓存
        /// </summary>
        /// <typeparam name="T">缓存类型</typeparam>
        /// <param name="key">主键</param>
        /// <returns>缓存值</returns>
        T Get<T>(string key);


        /// <summary>
        /// 根据Key列表获取缓存列表
        /// </summary>
        /// <typeparam name="T">缓存类型</typeparam>
        /// <param name="key">主键列表</param>
        /// <returns>缓存列表</returns>
        List<T> GetObjectsByKey<T>(List<string> key);



        /// <summary>
        /// 获取主键 缓存值 列表 根据主键列表
        /// </summary>
        /// <typeparam name="T">缓存类型</typeparam>
        /// <param name="TagList">主键列表</param>
        /// <returns></returns>
        Dictionary<string, T> GetKeyObjectsByKey<T>(List<string> key);

        /// <summary>
        /// 移除缓存
        /// </summary>
        /// <param name="key">主键</param>
        void Remove(string key);


        /// <summary>
        /// 移除缓存列表
        /// </summary>
        /// <param name="key">主键</param>
        void Remove(List<string> key);


       
        /// <summary>
        /// 增加缓存
        /// </summary>
        /// <param name="key">主键</param>
        /// <param name="value">缓存值</param>
        void Put(string key, object value);


        /// <summary>
        /// 增加缓存
        /// </summary>
        /// <param name="key">主键</param>
        /// <param name="value">缓存值</param>
        /// <param name="Seconds">缓存时间秒</param>
        void Put(string key, object value, int Seconds);


        /// <summary>
        /// 判断这个缓存是否存在
        /// </summary>
        /// <param name="key">值</param>
        /// <returns></returns>
        bool Exists(string key);


    }
}
